import 'package:flutter/material.dart';

import 'components/detail.dart';

class Navigatorcase extends StatelessWidget {
  const Navigatorcase({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('navigation')),
      body: Container(
        color: Colors.orange,
        child: TextButton(
            onPressed: () {
              // 二级详情组件用法
              // Navigator.push(context,
              //     MaterialPageRoute(builder: (context) => const Detail()));

              // 命名路由用法
              Navigator.pushNamed(context, '/detail');
            },
            child: const Text('详情跳转')),
      ),
    );
  }
}
